Vector galois field multiply sum and accumulate instruction

ABSTRACT

A Vector Galois Field Multiply Sum and Accumulate instruction. Each element of a second operand of the instruction is multiplied in a Galois field with the corresponding element of the third operand to provide one or more products. The one or more products are exclusively ORed with each other and exclusively ORed with a corresponding element of a fourth operand of the instruction. The results are placed in a selected operand.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of co-pending U.S. patent applicationSer. No. 13/748,510, filed Jan. 23, 2013, entitled “VECTOR GALOIS FIELDMULTIPLY SUM AND ACCUMULATE INSTRUCTION,” which is hereby incorporatedherein by reference in its entirety.

BACKGROUND

One or more aspects relate, in general, to processing within a computingenvironment, and in particular, to vector processing within such anenvironment.

Processing within a computing environment includes controlling operationof one or more central processing units (CPUs). Normally, operation of acentral processing unit is controlled by instructions in storage.Instructions may have different formats and often specify registers tobe used in performing various operations.

Depending on the architecture of the central processing unit, varioustypes of registers may be used including, for instance, general purposeregisters, special purpose registers, floating point registers and/orvector registers, as examples. Different types of registers may be usedwith different types of instructions. As examples, floating pointregisters store floating point numbers to be used by floating pointinstructions; and vector registers hold data for vector processingperformed by Single Instruction, Multiple Data (SIMD) instructions,including vector instructions.

BRIEF SUMMARY

Shortcomings of the prior art are overcome and advantages are providedthrough the provision of a method of executing a machine instruction.The method includes, for instance, obtaining, by a processor, a machineinstruction for execution, the machine instruction being defined forcomputer execution according to a computer architecture, the machineinstruction including: at least one opcode field to provide an opcode,the opcode identifying a Vector Galois Field Multiply Sum and Accumulateoperation; a first register field to be used to designate a firstregister, the first register including a first operand; a secondregister field to be used to designate a second register, the secondregister including a second operand; a third register field to be usedto designate a third register, the third register including a thirdoperand; a fourth register field to be used to designate a fourthregister, the fourth register including a fourth operand; and executingthe machine instruction, the executing including: multiplying one ormore elements of the second operand with one or more elements of thethird operand using carryless multiplication to obtain a plurality ofproducts; performing a first mathematical operation on the plurality ofproducts to obtain a first result; performing a second mathematicaloperation on the first result and one or more selected elements of thefourth operand to obtain a second result; and placing the second resultin the first operand.

Computer program products and systems relating to one or more aspectsare also described and may be claimed herein. Further, services relatingto one or more aspects are also described and may be claimed herein.

Additional features and advantages are realized through the techniquesof one or more aspects. Other embodiments and aspects are described indetail herein and are considered a part of the claims.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

One or more aspects are particularly pointed out and distinctly claimedas examples in the claims at the conclusion of the specification. Theforegoing and other objects, features, and advantages are apparent fromthe following detailed description taken in conjunction with theaccompanying drawings in which:

FIG. 1 depicts one example of a computing environment to incorporate anduse one or more aspects;

FIG. 2A depicts another example of a computing environment toincorporate and use one or more aspects;

FIG. 2B depicts further details of the memory of FIG. 2A;

FIG. 3 depicts one example of a register file;

FIG. 4A depicts one example of a format of a Vector Floating Point TestData Class Immediate instruction;

FIG. 4B depicts one example of bit values of the third operand of theVector Floating Point Test Data Class Immediate instruction of FIG. 4A;

FIG. 4C depicts one embodiment of the logic associated with the VectorFloating Point Test Data Class Immediate instruction of FIG. 4A;

FIG. 4D depicts one example of a block diagram of execution of theVector Floating Point Test Data Class Immediate instruction of FIG. 4A;

FIG. 4E depicts one example of a definition of various classes of binaryfloating point data;

FIG. 5A depicts one example of a format of a Vector Checksuminstruction;

FIG. 5B depicts one embodiment of the logic associated with the VectorChecksum instruction of FIG. 5A;

FIG. 5C depicts one example of a block diagram of execution of theVector Checksum instruction of FIG. 5A;

FIG. 6A depicts one example of a format of a Vector Galois FieldMultiply Sum and Accumulate instruction;

FIG. 6B depicts one embodiment of the logic associated with the VectorGalois Field Multiply Sum and Accumulate instruction of FIG. 6A;

FIG. 6C depicts one example of a block diagram of execution of theVector Galois Field Multiply Sum and Accumulate instruction of FIG. 6A;

FIG. 7A depicts one example of a format of a Vector Generate Maskinstruction;

FIG. 7B depicts one embodiment of the logic associated with the VectorGenerate Mask instruction of FIG. 7A;

FIG. 7C depicts one example of a block diagram of execution of theVector Generate Mask instruction of FIG. 7A;

FIG. 8A depicts one example of a format of a Vector Element Rotate andInsert Under Mask instruction;

FIG. 8B depicts one embodiment of the logic associated with the VectorElement Rotate and Insert Under Mask instruction of FIG. 8A;

FIG. 8C depicts one example of a block diagram of execution of theVector Element Rotate and Insert Under Mask instruction of FIG. 8A;

FIG. 9A depicts one example of a Vector Exception Code;

FIG. 9B depicts one embodiment of the logic to set the Vector ExceptionCode of FIG. 9A;

FIG. 10 depicts one embodiment of a computer program productincorporating one or more aspects;

FIG. 11 depicts one embodiment of a host computer system;

FIG. 12 depicts a further example of a computer system;

FIG. 13 depicts another example of a computer system comprising acomputer network;

FIG. 14 depicts one embodiment of various elements of a computer system;

FIG. 15A depicts one embodiment of the execution unit of the computersystem of FIG. 14;

FIG. 15B depicts one embodiment of the branch unit of the computersystem of FIG. 14;

FIG. 15C depicts one embodiment of the load/store unit of the computersystem of FIG. 14; and

FIG. 16 depicts one embodiment of an emulated host computer system.

DETAILED DESCRIPTION

In accordance with one or more aspects, a vector facility is providedthat includes various vector instructions, as well as vector exceptionprocessing. Each of the instructions described herein is a SingleInstruction, Multiple Data (SIMD) instruction that uses one or morevector registers (also referred to herein as vectors). A vector registeris, for instance, a processor register (also referred to as a hardwareregister), which is a small amount of storage (e.g., not main memory)available as part of a central processing unit (CPU) or other processor.Each vector register contains a vector operand having one or moreelements, and an element is, for example, one, two, four or eight bytesin length. In other embodiments, elements can be of other sizes; and avector instruction need not be a SIMD instruction.

One embodiment of a computing environment to incorporate and use one ormore aspects is described with reference to FIG. 1. A computingenvironment 100 includes, for instance, a processor 102 (e.g., a centralprocessing unit), a memory 104 (e.g., main memory), and one or moreinput/output (I/O) devices and/or interfaces 106 coupled to one anothervia, for example, one or more buses 108 and/or other connections.

In one example, processor 102 is based on the z/Architecture offered byInternational Business Machines Corporation, and is part of a server,such as the System z server, which is also offered by InternationalBusiness Machines Corporation and implements the z/Architecture. Oneembodiment of the z/Architecture is described in an IBM® publicationentitled, “z/Architecture Principles of Operation,” IBM® Publication No.SA22-7832-09, Tenth Edition, September, 2012, which is herebyincorporated herein by reference in its entirety. In one example, theprocessor executes an operating system, such as z/OS, also offered byInternational Business Machines Corporation. IBM®, Z/ARCHITECTURE® andZ/OS® are registered trademarks of International Business MachinesCorporation, Armonk, N.Y., USA. Other names used herein may beregistered trademarks, trademarks, or product names of InternationalBusiness Machines Corporation or other companies.

In a further embodiment, processor 102 is based on the PowerArchitecture offered by International Business Machines Corporation. Oneembodiment of the Power Architecture is described in “Power ISA™ Version2.06 Revision B,” International Business Machines Corporation, Jul. 23,2010, which is hereby incorporated herein by reference in its entirety.POWER ARCHITECTURE® is a registered trademark of International BusinessMachines Corporation.

In yet a further embodiment, processor 102 is based on an Intelarchitecture offered by Intel Corporation. One embodiment of the Intelarchitecture is described in “Intel® 64 and IA-32 ArchitecturesDeveloper's Manual: Vol. 2B, Instructions Set Reference, A-L,” OrderNumber 253666-045US, January 2013, and “Intel® 64 and IA-32Architectures Developer's Manual: Vol. 2B, Instructions Set Reference,M-Z,” Order Number 253667-045US, January 2013, each of which is herebyincorporated herein by reference in its entirety. Intel® is a registeredtrademark of Intel Corporation, Santa Clara, Calif.

Another embodiment of a computing environment to incorporate and use oneor more aspects is described with reference to FIG. 2A. In this example,a computing environment 200 includes, for instance, a native centralprocessing unit 202, a memory 204, and one or more input/output devicesand/or interfaces 206 coupled to one another via, for example, one ormore buses 208 and/or other connections. As examples, computingenvironment 200 may include a PowerPC processor, a pSeries server or anxSeries server offered by International Business Machines Corporation,Armonk, N.Y.; an HP Superdome with Intel Itanium II processors offeredby Hewlett Packard Co., Palo Alto, Calif.; and/or other machines basedon architectures offered by International Business Machines Corporation,Hewlett Packard, Intel, Oracle, or others.

Native central processing unit 202 includes one or more native registers210, such as one or more general purpose registers and/or one or morespecial purpose registers used during processing within the environment.These registers include information that represent the state of theenvironment at any particular point in time.

Moreover, native central processing unit 202 executes instructions andcode that are stored in memory 204. In one particular example, thecentral processing unit executes emulator code 212 stored in memory 204.This code enables the processing environment configured in onearchitecture to emulate another architecture. For instance, emulatorcode 212 allows machines based on architectures other than thez/Architecture, such as PowerPC processors, pSeries servers, xSeriesservers, HP Superdome servers or others, to emulate the z/Architectureand to execute software and instructions developed based on thez/Architecture.

Further details relating to emulator code 212 are described withreference to FIG. 2B. Guest instructions 250 stored in memory 204comprise software instructions (e.g., correlating to machineinstructions) that were developed to be executed in an architectureother than that of native CPU 202. For example, guest instructions 250may have been designed to execute on a z/Architecture processor 102, butinstead, are being emulated on native CPU 202, which may be, forexample, an Intel Itanium II processor. In one example, emulator code212 includes an instruction fetching routine 252 to obtain one or moreguest instructions 250 from memory 204, and to optionally provide localbuffering for the instructions obtained. It also includes an instructiontranslation routine 254 to determine the type of guest instruction thathas been obtained and to translate the guest instruction into one ormore corresponding native instructions 256. This translation includes,for instance, identifying the function to be performed by the guestinstruction and choosing the native instruction(s) to perform thatfunction.

Further, emulator 212 includes an emulation control routine 260 to causethe native instructions to be executed. Emulation control routine 260may cause native CPU 202 to execute a routine of native instructionsthat emulate one or more previously obtained guest instructions and, atthe conclusion of such execution, return control to the instructionfetch routine to emulate the obtaining of the next guest instruction ora group of guest instructions. Execution of the native instructions 256may include loading data into a register from memory 204; storing databack to memory from a register; or performing some type of arithmetic orlogic operation, as determined by the translation routine.

Each routine is, for instance, implemented in software, which is storedin memory and executed by native central processing unit 202. In otherexamples, one or more of the routines or operations are implemented infirmware, hardware, software or some combination thereof. The registersof the emulated processor may be emulated using registers 210 of thenative CPU or by using locations in memory 204. In embodiments, guestinstructions 250, native instructions 256 and emulator code 212 mayreside in the same memory or may be disbursed among different memorydevices.

As used herein, firmware includes, e.g., the microcode, millicode and/ormacrocode of the processor. It includes, for instance, thehardware-level instructions and/or data structures used inimplementation of higher level machine code. In one embodiment, itincludes, for instance, proprietary code that is typically delivered asmicrocode that includes trusted software or microcode specific to theunderlying hardware and controls operating system access to the systemhardware.

In one example, a guest instruction 250 that is obtained, translated andexecuted is an instruction described herein. The instruction, which isof one architecture (e.g., the z/Architecture) is fetched from memory,translated and represented as a sequence of native instructions 256 ofanother architecture (e.g., PowerPC, pSeries, xSeries, Intel, etc.).These native instructions are then executed.

In one embodiment, the instructions described herein are vectorinstructions, which are part of a vector facility. The vector facilityprovides, for instance, fixed sized vectors ranging from one to sixteenelements. Each vector includes data which is operated on by vectorinstructions defined in the facility. In one embodiment, if a vector ismade up of multiple elements, then each element is processed in parallelwith the other elements. Instruction completion does not occur untilprocessing of all the elements is complete. In other embodiments, theelements are processed partially in parallel and/or sequentially.

Vector instructions can be implemented as part of various architectures,including, but not limited to, the z/Architecture, Power, x86, IA-32,IA-64, etc. Although embodiments described herein are for thez/Architecture, the vector instructions described herein and one or moreother aspects may be based on many other architectures. Thez/Architecture is only one example.

In one embodiment in which the vector facility is implemented as part ofthe z/Architecture, to use the vector registers and instructions, avector enablement control and a register control in a specified controlregister (e.g., control register 0) are set to, for instance, one. Ifthe vector facility is installed and a vector instruction is executedwithout the enablement controls set, a data exception is recognized. Ifthe vector facility is not installed and a vector instruction isexecuted, an operation exception is recognized.

In one embodiment, there are 32 vector registers and other types ofregisters can map to a quadrant of the vector registers. For instance,as shown in FIG. 3, a register file 300 includes 32 vector registers 302and each register is 128 bits in length. Sixteen floating pointregisters 304, which are 64 bits in length, can overlay the vectorregisters. Thus, as an example, when floating point register 2 ismodified, then vector register 2 is also modified. Other mappings forother types of registers are also possible.

Vector data appears in storage, for instance, in the same left-to-rightsequence as other data formats. Bits of a data format that are numbered0-7 constitute the byte in the leftmost (lowest-numbered) byte locationin storage, bits 8-15 form the byte in the next sequential location, andso on. In a further example, the vector data may appear in storage inanother sequence, such as right-to-left.

Each of the vector instructions described herein has a plurality offields, and one or more of the fields has a subscript number associatedtherewith. The subscript number associated with a field of theinstruction denotes the operand to which the field applies. Forinstance, the subscript number 1 associated with vector register V₁denotes that the register in V₁ includes the first operand, and soforth. A register operand is one register in length, which is, forinstance, 128 bits.

Further, many of the vector instructions provided with the vectorfacility have a field of specified bits. This field, referred to as theregister extension bit or RXB, includes the most significant bit foreach of the vector register designated operands. Bits for registerdesignations not specified by the instruction are to be reserved and setto zero. The most significant bit is concatenated, for instance, to theleft of the four-bit register designation to create a five-bit vectorregister designation.

In one example, the RXB field includes four bits (e.g., bits 0-3), andthe bits are defined, as follows:

-   -   0—Most significant bit for the first vector register designation        (e.g., in bits 8-11) of the instruction.    -   1—Most significant bit for the second vector register        designation (e.g., in bits 12-15) of the instruction, if any.    -   2—Most significant bit for the third vector register designation        (e.g., in bits 16-19) of the instruction, if any.    -   3—Most significant bit for the fourth vector register        designation (e.g., in bits 32-35) of the instruction, if any.

Each bit is set to zero or one by, for instance, the assembler dependingon the register number. For instance, for registers 0-15, the bit is setto 0; for registers 16-31, the bit is set to 1, etc.

In one embodiment, each RXB bit is an extension bit for a particularlocation in an instruction that includes one or more vector registers.For instance, in one or more vector instructions, bit 0 of RXB is anextension bit for location 8-11, which is assigned to, e.g., V₁; bit 1of RXB is an extension bit for location 12-15, which is assigned to,e.g., V₂; and so forth. In a further embodiment, the RXB field includesadditional bits, and more than one bit is used as an extension for eachvector or location.

One instruction provided in accordance with one aspect that includes theRXB field is a Vector Floating Point Test Data Class Immediate (VFTCI)instruction, an example of which is depicted in FIG. 4A. In one example,the Vector Floating Point Test Data Class Immediate instruction 400includes opcode fields 402 a (e.g., bits 0-7), 402 b (e.g., bits 40-47)indicating a Vector Floating Point Test Data Class Immediate operation;a first vector register field 404 (e.g., bits 8-11) used to designate afirst vector register (V₁); a second vector register field 406 (e.g.,bits 12-15) used to designate a second vector register (V₂); animmediate field (I₃) 408 (e.g., bits 16-27) to include a bitmask; afirst mask field (M₅) 410 (e.g., bits 28-31); a second mask field (M₄)412 (e.g., bits 32-35); and an RXB field 414 (e.g., bits 36-39). Each ofthe fields 404-414, in one example, is separate and independent from theopcode field(s). Further, in one embodiment, they are separate andindependent from one another; however, in other embodiments, more thanone field may be combined. Further information on the use of thesefields is described below.

In one example, selected bits (e.g., the first two bits) of the opcodedesignated by opcode field 402 a specify the length of the instruction.In this particular example, the selected bits indicate that the lengthis three halfwords. Further, the format of the instruction is a vectorregister-and-immediate operation with an extended opcode field. Each ofthe vector (V) fields, along with its corresponding extension bitspecified by RXB, designates a vector register. In particular, forvector registers, the register containing the operand is specifiedusing, for instance, a four-bit field of the register field with theaddition of its corresponding register extension bit (RXB) as the mostsignificant bit. For instance, if the four bit field is 0110 and theextension bit is 0, then the five bit field 00110 indicates registernumber 6.

Further, in one embodiment of the VFTCI instruction, V₁ 404 and V₂ 406specify vector registers that include a first operand and a secondoperand, respectively, for the instruction. Additionally, I₃ 408includes a bit mask having a plurality of bits, and each bit is used torepresent a binary floating point element class and a sign (positive ornegative), as described in further detail below.

In a further embodiment, the bit mask may be provided in a generalpurpose register, in memory, in an element of a vector register(differing per element) or from an address computation, as examples. Itmay be included as an explicit operand of the instruction or as animplied operand or input.

M₅ field 410 has, for instance, four bits, 0-3, and specifies a singleelement control (S) in, for instance, bit 0. If bit 0 is set to one, theoperation takes place only on the zero-indexed element in the vector.The bit positions of all other elements in the first operand vector areunpredictable. If bit 0 is set to zero, the operation occurs on allelements in the vector.

M₄ field 412 is used, for instance, to specify the size of the floatingpoint numbers in the second operand of the instruction. In one example,this field is set to 3, indicating a double precision binary floatingpoint number. Other examples are also possible.

In execution of one embodiment of the Vector Floating Point Test DataClass Immediate instruction, the class and sign of the floating pointelement or elements of the second operand are examined to select one ormore bits from the third operand. If a selected bit is set, all bitpositions of the corresponding element in the first operand are set toones; otherwise, they are set to zero. That is, if the class/sign of thefloating point number contained in an element of the second operandmatches a set bit (i.e., a bit set to, e.g., one) in the third operand,then an element of the first operand corresponding to the element of thesecond operand is set to ones. In one example, all operand elementscontain long format BFP (binary floating point) numbers.

As indicated herein, the 12 bits of the third operand, bits 16-27 of theinstruction text, are used to specify 12 combinations of BFP data classand sign. In one example, as shown in FIG. 4B, BFP operand elements aredivided into six classes 430: zero, normal number, subnormal number,infinity, quiet NaN (Not-a-Number), and signaling NaN, and each classhas a sign 432 (either positive or negative) associated therewith. Thus,for instance, bit 0 of I₃ specifies a zero class with a positive sign,and bit 1 specifies a zero class with a negative sign, etc.

One or more of the third operand bits may be set to one. Further, in oneembodiment, the instruction may operate on one or more elements at thesame time.

Operand elements, including SNaNs (Signaling NaNs) and QNaNs (QuietNaNs), are examined without causing an IEEE exception.

Resulting Summary Condition Code for all the elements:

-   -   0 Selected bit is 1 for all elements (match)    -   1 Selected bit is 1 for at least one, but not all elements (when        S-bit is zero)    -   2 - - -    -   3 Selected bit is 0 for all elements (no match)

IEEE Exceptions: None

Program Exceptions:

-   -   Data with a data exception code (DXC) FE, Vector Instruction,        indicating a vector facility is not enabled    -   Operation (if the vector facility for z/Architecture is not        installed)    -   Specification    -   Transaction constraint

Programming Notes:

-   -   1. This instruction provides a way to test operand elements        without a risk of an exception or setting the IEEE flags.    -   2. When the S bit is set, a Condition Code of 1 is not used.

Further details relating to one embodiment of the Vector Floating PointTest Data Class Immediate instruction are described with reference toFIGS. 4C and 4D. In particular, FIG. 4C depicts one embodiment of thelogic associated with the Vector Floating Point Test Data ClassImmediate instruction performed by a processor (e.g., a CPU), and FIG.4D depicts one example of a block diagram illustrating execution of theVector Floating Point Test Data Class Immediate instruction.

Referring to FIG. 4C, initially, a variable referred to as element index(Ei) is initialized to zero, STEP 450. Then, the value in element Ei,which in this case is element 0, is extracted from the second operand ofthe instruction (e.g., from the operand stored in the registerdesignated by V₂), STEP 452. This value, which is a long format binaryfloating point value, is converted to a type number to obtain a classand sign for the floating point element of the second operand, asdescribed below, STEP 454. In one example, the size of the floatingpoint number 453 is input to the convert logic. The obtained class andsign are associated with a particular class/sign bit, as described withreference to FIG. 4B. For instance, if the conversion indicates thefloating point number is a positive, normal number, then bit 2 isassociated with the floating point number.

Subsequent to conversion, the bit in the third operand (referred to asthe selected bit) that corresponds to the particular bit that wasdetermined based on conversion is checked, STEP 456. If the selected bitis set, INQUIRY 458, then the element in the first operand correspondingto element (Ei) is set equal to all ones, STEP 460; otherwise, thatelement in the first operand is set equal to zero, STEP 462. Forinstance, if conversion of the floating point number in element 0indicates a positive, normal number, then bit 2 is associated with thenumber. Thus, bit 2 of the third operand is checked, and if it is set toone, element 0 of the first operand is set to all ones.

Thereafter, a determination is made as to whether Ei is equal to themaximum number of elements of the second operand, INQUIRY 464. If not,then Ei is incremented by, e.g., one, STEP 466, and processing continueswith STEP 452. Otherwise, if Ei is equal to the maximum number ofelements, then a summary condition code is generated, STEP 468. Thesummary condition code summarizes the processing for all the elements ofthe second operand. For instance, if the selected bit is one for all theelements (match), then the resulting condition code is zero. On theother hand, if the selected bit is 1, for at least one, but not all ofthe elements (when S-bit is not zero), then the condition code is 1, andif the selected bit is zero for all of the elements (no match), then thecondition code is 3.

The above processing is pictorially shown in the block diagram of FIG.4D. As depicted, a vector register 480 includes a plurality of elements482 a-482 n, each including a floating point number. Each floating pointnumber and the size of the floating point number 483 a-483 n are inputto convert-to-type number logic 484 a-484 n, and the output is aparticular bit representing a class/sign for the floating point number.Then, a selected bit in each mask 486 a-486 b corresponding to eachparticular bit is checked. Depending on whether the selected bit is set,the first operand in a vector register 488 is set. For instance, if forelement 0 of the second operand, the selected bit is set, then element490 a of the first operand is set to all ones. Similarly, if theselected bit for element 1 of the second operand is not set (e.g., setto zero), then element 490 b of the first operand is set to zero, etc.

Further details of one embodiment of the convert-to-type number logicare now described. Initially, the floating point number, which is astandard IEEE binary floating point number, is converted into threeparts: a sign, an exponent (8 bits)+127, and a fraction (23 bits), as isknown. Then, the values of all three parts are checked to determine theclass and sign, as shown in FIG. 4E. For instance, the sign is the valueof the sign part, and the class (a.k.a., entity in FIG. 4E) is based onthe values of the exponent and fraction (the unit bit in FIG. 4E is animplied bit of the fraction). As an example, if the values of theexponent and fraction (including the unit bit) are zeros, then, theclass is zero and if the sign part is positive, then the sign ispositive. Thus, bit 0 (FIG. 4B) represents the class/sign of thisfloating point number.

Described above is one embodiment of an instruction to test the floatingpoint class of elements in a vector and setting a resulting bitmask. TheVector Floating Point Test Data Class Immediate instruction has animmediate field where each bit represents a class of floating pointnumbers to detect. Each floating point element of an input vector istested to see if the value is in any of the classes specified by theinstruction. If the floating point element is in one of the classes, thebit positions of the corresponding element of the output vector are setto 1. This provides a technique to determine some properties (e.g.,class and sign) about a binary floating point number without causing anyexceptions or interruptions.

In a further embodiment, the testing can be performed by checking whichbits of the third operand are set (e.g., to one), and then determiningwhether the class/sign of one or more elements of the second operand arethe same as one of the set bits. The first operand is then set based onthe comparison.

In a further aspect, a Vector Checksum instruction is provided, anexample of which is depicted in FIG. 5A. In one example, the VectorChecksum instruction 500 includes opcode fields 502 a (e.g., bits 0-7),502 b (e.g., bits 40-47) indicating a vector checksum operation; a firstvector register field 504 (e.g., bits 8-11) used to designate a firstvector register (V₁); a second vector register field 506 (e.g., bits12-15) used to designate a second vector register (V₂); a third vectorregister field 508 (e.g., bits 16-19) used to designate a third vectorregister (V₃); and an RXB field 510 (e.g., bits 36-39). Each of thefields 504 to 510, in one example, is separate and independent from theopcode field(s). Further, in one embodiment, they are separate andindependent from one another; however, in other embodiments, more thanone field may be combined.

In a further embodiment, the third vector register field is not includedas an explicit operand of the instruction, but instead, it is an impliedoperand or input. Further, the value provided in the operand may beprovided in other ways, such as in a general purpose register, inmemory, as an address computation, etc.

In yet a further embodiment, the third operand, explicit or implied, isnot provided at all.

In one example, selected bits (e.g., the first two bits) of the opcodedesignated by opcode field 502 a specify the length of the instruction.In this particular example, the selected bits indicate that the lengthis three halfwords. Further, the format of the instruction is a vectorregister-and-register operation with an extended opcode field. Each ofthe vector (V) fields, along with this corresponding extension bitspecified by RXB, designates a vector register. In particular, forvector registers, the register containing the operand is specifiedusing, for instance, a four bit field of the register field with theaddition of its corresponding register extension bit (RXB) as the mostsignificant bit.

In execution of one embodiment of the Vector Checksum instruction, theelements from the second operand, which are, for instance, word-sized,are added together one-by-one along with a selected element of the thirdoperand, e.g., the element in word one of the third operand. (In anotherembodiment, the adding of the selected element of the third operand isoptional.) The sum is placed in a selected location, e.g., word one, ofthe first operand. Zeros are placed in the other word elements, e.g.,word elements 0, and 2-3, of the first operand. The word-sized elementsare all treated as 32-bit unsigned binary integers. After each additionof an element, a carry out of, e.g., bit position 0 of the sum is addedto, e.g., bit position 31 of the result in word element one of the firstoperand.

Condition Code: The code remains unchanged.

Program Exceptions:

-   -   Data with a data exception code (DXC) FE, Vector Instruction,        indicating the vector facility is not enabled    -   Operation (if the vector facility for z/Architecture is not        installed)    -   Transaction constraint

Programming Notes:

-   -   1. The contents of the third operand are to contain zero at the        start of a checksum computation algorithm.    -   2. A 16-bit checksum is used in, for example, a TCP/IP        application. The following program can be executed after a        32-bit checksum has been computed:        -   VERLLF V2,V1,16(0) (VERLLF—Vector Element Rotate Left            Logical—4-byte value)        -   VAF V2,V1,V2 (VAF—Vector Add—4 byte value)        -   The halfword in element 2 contains the 16-bit checksum.

Further details regarding the Vector Checksum instruction are describedwith reference to FIGS. 5B and 5C. In one example, FIG. 5B depicts oneembodiment of the logic performed by a processor in execution of theVector Checksum instruction, and FIG. 5C depicts a block diagram of oneexample of execution of the Vector Checksum instruction.

Referring to FIG. 5B, initially, the element index (Ey) for the firstoperand (OP1) is set, e.g., to one, indicating element 1 of the firstoperand, STEP 530. Similarly, the element index (Ex) for the thirdoperand (OP3) is set, e.g., to one, indicating element 1 of the thirdoperand, STEP 532. Then, element index (Ei) is set equal to 0, and theelement at element index (Ey), i.e., element 1 in this example, isinitialized to zero, STEP 534. In a further embodiment, Ex and Ey may beset to any valid element index.

An end around carry (EAC) add is performed in whichOP1(Ey)=OP1(Ey)+OP2(Ei)+OP2(Ei+1), STEP 536. Thus, element 1 of theoutput vector (OP1) is set equal to the contents of that element plusthe value in element 0 of the second operand (OP2) and the value inelement 1 of the second operand. With an end around carry add, anaddition operation is performed and any carry out from the addition isadded back in to the sum to produce a new sum.

In a further embodiment, instead of adding as described above, thefollowing is performed: a temporary accumulator value is defined andinitialized to zero, and then one element is added at a time. As afurther embodiment, all words are added in parallel and there is notemporary accumulator. Other variations are also possible.

Thereafter, a determination is made as to whether there are additionalelements to be added in the second operand, INQUIRY 538. For instance,is Ei−2<# of elements of the second operand. If there are more secondoperand elements to be added, then Ei is incremented, e.g., by two, STEP540, and processing continues with STEP 536.

Subsequent to adding the elements across the second operand, the resultis added to a value in the third operand. For instance, an end aroundcarry add of element (Ey) of the first operand (which is the sum of theEAC add across all second operand elements) and a value in element (Ex)of the third operand (OP3) is performed (i.e., EAC ADD OP1(Ey)+OP3(Ex)), STEP 542. This is pictorially shown in FIG. 5C.

As shown in FIG. 5C, the second operand 550 includes a plurality ofelements 552 a-552 n, and those elements are added together one-by-onealong with the element in word 1 (562) of the third operand 560. Theresult is placed in element 1 (572) of the first operand 570. This ismathematically shown by the equation Ey=Ex+the summation of E_(i) wherei=0 to n, and the addition is an end around carry addition.

Described above is one embodiment of a Vector Checksum instruction thatperforms a checksum across the elements of a vector register, instead ofperforming lane arithmetic. In one embodiment, the Vector Checksuminstruction performs checksums by performing a sum-across with endaround carry additions. In one example, the Vector Checksum instructiontakes four 4-byte integer elements from a vector register and adds themtogether. Any carries from the additions are added back in. The 4-bytesum is added to a 4-byte element in another operand, and then saved inyet a further vector register (e.g., the low order 4-byte element of avector register with zeros stored in the higher order elements of thevector register).

In a further embodiment, the further vector register or another registeris not used to save the value, but instead, one of the other registers(i.e., operands) is used as an accumulator.

The checksum that is provided may be used to preserve data integrity. Achecksum is often applied to data and sent over a noisy channel in orderto verify the received data is correct. In this example, as describedherein, the checksum is computed by adding sequential 4-byte integerstogether. If there is a carryout of the integer arithmetic operation,the carry, and an additional one, is added to the running sum.

Although checksums are described herein, a similar technique may be usedfor other end around carry additions.

A further instruction provided in accordance with one aspect is a VectorGalois Field Multiply Sum and Accumulate (VGFMA) instruction, an exampleof which is depicted in FIG. 6A. In one example, the Vector Galois FieldMultiply Sum and Accumulate instruction 600 includes opcode fields 602 a(e.g., bits 0-7), 602 b (e.g., bits 40-47) indicating a Vector GaloisField Multiply Sum and Accumulate operation; a first vector field 604(e.g., bits 8-11) used to designate a first vector register (V₁); asecond vector register field 606 (e.g., bits 12-15) used to designate asecond vector register (V₂); a third vector register field 608 (e.g.,bits 16-19) used to indicate a third vector register (V₃); a mask field(M₅) 610 (e.g., bits 20-23); a fourth vector register field 612 (e.g.,bits 32-35) used to designate a fourth vector register (V₄); and an RXBfield 614 (e.g., bits 36-39). Each of the fields 604-614, in oneexample, is separate and independent from the opcode field(s). Further,in one embodiment, they are separate and independent from one another;however, in other embodiments, more than one field may be combined.

In one example, selected bits (e.g., the first two bits) of the opcodedesignated by opcode field 602 a specify the length of the instruction.In this particular example, the selected bits indicate that the lengthis three halfwords. Further, the format of the instruction is a vectorregister-and-register operation with an extended opcode field. Each ofthe vector (V) fields, along with its corresponding extension bitspecified by RXB, designates a vector register. In particular, forvector registers, the register containing the operand is specifiedusing, for instance, a 4-bit field of the register field with theaddition of its corresponding register extension bit (RXB) as the mostsignificant bit.

M₅ field 610 has, for instance, 4 bits, 0-3, and specifies an elementsize (ES) control. The element size control specifies the size of theelements in vector register operands two and three; the elements in thefirst and fourth operand are twice the size of those specified by the EScontrol. For instance, a value of 0 in M₅ indicates byte-sized elements;1 indicates halfword; 2 indicates word; and 3 indicates doubleword, asexamples.

In execution of one embodiment of the Vector Galois Field Multiple Sumand Accumulate instruction, each element of the second operand ismultiplied in a Galois field (i.e., a finite field having a finitenumber of elements) with the corresponding element of the third operand.That is, each element of the second operand is multiplied with thecorresponding element of the third operand using carrylessmultiplication. The Galois field has an order of two, in one example.This multiplication is similar to standard binary multiplication, butinstead of adding the shifted multiplicand, it is exclusively ORed(XOR). The resulting even-odd pairs of, for instance, doubleelement-sized products are exclusive ORed with each other and exclusiveORed with the corresponding element, e.g., double-wide element, of thefourth operand. The results are placed in, for instance, the double-wideelements of the first operand.

Condition Code: The code remains unchanged.

Program Exceptions:

-   -   Data with a data exception code (DXC) FE, Vector Instruction,        indicating the vector facility is not enabled    -   Operation (if the vector facility for z/Architecture is not        installed)    -   Specification    -   Transaction constraint

In a further embodiment, the instruction may include one or more feweroperands. For instance, instead of a fourth operand, the value to beexclusively ORed is in the first operand, which will also include theresults. Other variations are also possible.

Further details regarding one embodiment of execution of a Vector GaloisField Multiply Sum and Accumulate instruction is described withreference to FIGS. 6B and 6C. In one example, FIG. 6B depicts oneembodiment of the logic performed by a processor to execute a VectorGalois Field Multiply Sum and Accumulate instruction, and FIG. 6Cdepicts one example of a block diagram showing execution of the logic.

Referring to FIG. 6B, initially, even/odd pairs are extracted from thesecond operand (OP2), the third operand (OP3), and the fourth operand(OP4), STEP 630, and a carryless multiply sum accumulate function isperformed, STEP 632. For instance, when operating in a Galois field of apower of 2, the carryless multiplication is a shift and XOR (exclusiveOR), which effectively ignores any carry. The result is placed in thefirst operand (OP1), STEP 634, and a determination is made as to whetherthere are more pairs to be extracted, INQUIRY 636. If there are morepairs, then processing continues with STEP 630; otherwise, processing iscomplete, STEP 638. In one example, the element size 631 is an input toSTEPs 630-634.

Further details of the carryless multiply sum accumulate function ofSTEP 632 are described with reference to FIG. 6C. As shown, a pair ofoperands OP2H 652 a, OP2L 652 b are extracted from the second operand650. Further, operand pair OP3H 662 a, OP3L 662 b are extracted fromthird operand 660, and operand pair OP4H 672 a and OP4L 672 b areextracted from fourth operand 670. Operand OP2H 652 a is multiplied witha carryless multiplication to operand OP3H 662 a, and a Result H 680 ais provided. Similarly, operand OP2L 652 b is multiplied using acarryless multiplication to operand OP3L 662 b, and a Result L 680 b isprovided. Result H 680 a is then exclusively ORed with Result L 680 b,and that result is exclusively ORed with operand OP4H 672 a and operandOP4L 672 b, and the result is placed in OP1H 690 a, OP1L 690 b.

Described herein is a vector instruction that performs a carrylessmultiply operation and then performs a final exclusive OR to create anaccumulated sum. This technique may be used with various aspects oferror detection codes and cryptography that perform operations in afinite field with an order of 2.

In one example, the instruction performs a carryless multiply operationon a plurality of elements of a vector register to obtain a sum.Further, the instruction performs a final exclusive OR on the sum tocreate an accumulated sum. When executed, the instruction multiplies ina Galois field corresponding elements of a second vector and a thirdvector, and the shifted multiplicand is XORed. Each double-wide productis XORed with each other, and the result is XORed with a double-widecorresponding element of a first vector. The result is stored in thefirst vector register. Although double-word elements are describedabove, word-sized elements of other element sizes may be used. Theinstruction can operate on multiple different element sizes.

A further instruction provided in accordance with one aspect is a VectorGenerate Mask (VGM) instruction, an example of which is described withreference to FIG. 7A. In one example, the Vector Generate Maskinstruction 700 includes opcode fields 702 a (e.g., bits 0-7), 702 b(e.g., bits 40-47) indicating a Vector Generate Mask operation; a firstvector register field 704 (e.g., bits 8-11) used to designate a firstvector register (V₁); a first immediate field I₂ 706 (e.g., bits 16-24)used to specify a first value; a second immediate field (I₃) 708 (e.g.,bits 24-32) used to specify a second value; a mask field (M₄) 710 (e.g.,bits 32-35); and an RXB field 712 (e.g., bits 36-39). Each of the fields704-712, in one example, is separate and independent from the opcodefield(s). Further, in one embodiment, they are separate and independentfrom one another; however, in other embodiments, more than one field maybe combined.

In a further embodiment, the first value and/or the second value may beprovided in a general purpose register, in memory, in an element of avector register (differing per element) or from an address computation,as examples. It may be included as an explicit operand of theinstruction or as an implied operand or input.

In one example, selected bits (e.g., the first two bits) of the opcodedesignated by opcode field 702 a specify the length of the instruction.In this particular example, the selected bits indicate that the lengthis three halfwords. Further, the format of the instruction is a vectorregister-and-immediate operation with an extended opcode field. Each ofthe vector (V) fields, along with its corresponding extension bitspecified by RXB, designates a vector register. In particular, forvector registers, the register containing the operand is specifiedusing, for instance, a four-bit field of the register field with theaddition of its corresponding register extension bit (RXB) as the mostsignificant bit.

The M₄ field specifies, for instance, an element size control (ES). Theelement size control specifies the size of the elements in the vectorregister operands. In one example, bit 0 of the M₄ field specifies abyte; bit 1 specifies a halfword (e.g., 2 bytes); bit 2 specifies a word(e.g., 4 bytes; a.k.a. fullword); and bit 3 specifies a doubleword.

In execution of one embodiment of the Vector Generate Mask instruction,for each element in the first operand, a bit mask is generated. The maskincludes bits set to one starting at the bit position specified by,e.g., the unsigned integer value in I₂ and ending with the bit positionspecified by, e.g., the unsigned integer value in I₃. All other bitpositions are set to zero. In one example, only the number of bitsneeded to represent all of the bit positions for the specified elementsize are used from the I₂ and I₃ fields; other bits are ignored. If thebit position in the I₂ field is greater than the bit position in the I₃field, the range of bits wraps at the maximum bit position for thespecified element size. For instance, assuming byte-sized elements, ifI₂=1 and I₃=6, the resulting mask is X^(|)7E^(|) or B^(|)01111110^(|).However, if I₂=6 and I₃=1, then the resulting mask is X^(|)81^(|) orb^(|)10000001^(|).

Condition Code: The code remains unchanged.

Program Exceptions:

-   -   Data with a data exception code (DXC) FE, Vector Instruction,        indicating the vector facility is not enabled    -   Operation (if the vector facility for z/Architecture is not        installed)    -   Specification    -   Transaction constraint

Further details regarding one embodiment of the Vector Generate Maskinstruction are described with reference to FIGS. 7B and 7C. Inparticular, FIG. 7B depicts one embodiment of the logic associated withthe Vector Generate Mask instruction performed by a processor, and FIG.7C depicts one example of a block diagram illustrating one embodiment ofexecution of the Vector Generate Mask instruction.

Referring to FIG. 7B, initially, a mask is generated for each element inthe first operand, STEP 720. This step uses various inputs, includingthe value specified in the second operand field as the starting position(722), and the value specified in the third operand field as the endingposition (724), and the size of the elements as specified in the M₄field (726). These inputs are used to generate the mask and fill thepositions of a selected element, e.g., element 0, of the first operand(Op1), STEP 730. For instance, element 0 of the first operand (Op1)includes a plurality of positions (e.g., bit positions) and starting atthe position specified by the unsigned integer value in I₂ and ending atthe position specified in the unsigned integer value in I₃, positions(e.g., bits) of element 0 of the first operand are set to 1. The otherbit positions are set to 0. Thereafter, a determination is made as towhether there are more elements in the first operand, INQUIRY 734. Ifthere are more elements, then processing continues with STEP 720.Otherwise, processing is complete, STEP 736.

The generation of the mask and the filling of the first operand arepictorially depicted in FIG. 7C. As shown, masks for each element of thefirst operand are generated 720 using the inputs (e.g., 722-726), andthe results of generating the masks are stored in elements of the firstoperand 740.

Described in detail above is an instruction to generate bit masks foreach element of a vector. In one embodiment, the instruction takes astarting bit position and an ending bit position and creates a bit maskthat is replicated for each element. The instruction specifies a bitrange and each bit within the range, is set to one for each element ofthe vector register, while other bits are set to zero.

In one embodiment, using an instruction to generate bit masks providesbenefits over, for instance, loading bit masks from memory, whichincreases a cache footprint of an instruction stream and depending onhow many masks are needed could increase the latency in a critical loop.

A yet further instruction provided in accordance with an aspect is aVector Element Rotate and Insert Under Mask (VERIM) instruction, anexample of which is depicted in FIG. 8A. In one example, the VectorElement Rotate and Insert Under Mask instruction 800 includes opcodefields 802 a (e.g., bits 0-7), 802 b (e.g., bits 40-47) indicating aVector Element Rotate and Insert Under Mask operation; a first vectorregister field 804 (e.g., bits 8-11) used to designate a first vectorregister (V₁); a second vector register field 806 (e.g., bits 12-15)used to designate a second vector register (V₂); a third vector registerfield 808 (e.g., bits 16-19) used to designate a third vector register(V₃); an immediate field (I₄) 812 (e.g., bits 24-31) that includes,e.g., an unsigned binary integer specifying the number of bits to rotateeach element; a mask field (M₅) 814 (e.g., bits 32-35); and an RXB field816 (e.g., bits 36-39). Each of the fields 804-816, in one example, isseparate and independent from the opcode field(s). Further, in oneembodiment, they are separate and independent from one another; however,in other embodiments, more than one field may be combined.

In one example, selected bits (e.g., the first two bits) of the opcodedesignated by opcode field 802 a specify the length of the instruction.In this particular example, the selected bits indicate that the lengthis three halfwords. Further, the format of the instruction is the vectorregister-and-immediate operation with an extended opcode field. Each ofthe vector (V) fields, along with its corresponding extension bitspecified by RXB, designates a vector register. In particular, forvector registers, the register containing the operand is specifiedusing, for instance, a 4-bit field of the register field with theaddition of its corresponding register extension bit (RXB) as the mostsignificant bit.

The M₅ field specifies the element size control (ES). The element sizecontrol specifies the size of the elements in the vector registeroperands. In one example, bit 0 of the M₅ field specifies a byte; bit 1specifies a halfword (e.g., 2 bytes); bit 2 specifies a word (e.g., 4bytes; a.k.a. fullword); and bit 3 specifies a doubleword.

In execution of one embodiment of a Vector Element Rotate and InsertUnder Mask instruction, each element of the second operand is rotatedleft by the number of bits specified by the fourth operand. Each bitshifted out of the leftmost bit position of the element reenters in therightmost bit position of the element. The third operand includes a maskin each element. For each bit in the third operand that is one, thecorresponding bit of the rotated elements in the second operand replacesthe corresponding bit in the first operand. That is, a value of thecorresponding bit of the rotated elements replaces a value of thecorresponding bit in the first operand. For each bit in the thirdoperand that is zero, the corresponding bit of the first operand remainsunchanged. Except for the case when the first operand is the same aseither the second or third operand, the second and third operands remainunchanged.

The fourth operand is, e.g., an unsigned binary integer specifying thenumber of bits by which to rotate each element in the second operand. Ifthe value is larger than the number of bits in the specified elementsize, the value is reduced modulo the number of bits in the element.

In one example, the mask included in the third operand is generatedusing the VGM instruction described herein.

Condition Code: The code remains unchanged.

Program Exceptions:

-   -   Data with a data exception code (DXC) FE, Vector Instruction,        indicating the vector facility is not enabled    -   Operation (if the vector facility for z/Architecture is not        installed)    -   Specification    -   Transaction constraint

Programming Notes:

-   -   1. A combination of VERIM and VGM may be used to accomplish the        full functionality of a Rotate and Insert Selected Bits        instruction.    -   2. Although the bits of the I₄ field are defined to contain an        unsigned binary integer specifying the number of bits to rotate        each element left, a negative value may be coded which        effectively specifies a rotate-right amount.

Further details regarding execution of the Vector Element Rotate andInsert Under Mask instruction are described with reference to FIGS. 8Band 8C. In particular, FIG. 8B depicts one embodiment of the logicassociated with the Vector Element Rotate and Insert Under Maskinstruction performed by a processor, and FIG. 8C pictorially depictsone example of execution of the Vector Element Rotate and Insert UnderMask instruction.

Referring to FIG. 8B, a selected element of the second operand isrotated, STEP 830, by an amount specified in a fourth operand (820). Ifthe value specified in the fourth operand is larger than the number ofbits specified in the element size (822), then that value is reducedmodulo the number of bits in the element.

Subsequent to rotating the bits of the element, a merge under mask isperformed, STEP 832. For instance, for each bit in the third operand(824) that is 1, the corresponding bit of the rotated element in thesecond operand replaces the corresponding bit in the first operand.

Thereafter, a determination is made as to whether there are moreelements to be rotated, INQUIRY 834. If there are more elements to berotated, then processing continues with STEP 830. Otherwise, processingis complete, STEP 836.

Referring to FIG. 8C, as shown, elements of the second operand arerotated 830 based on inputs 820 and 822. Further, a merge under mask isperformed 832 using input 824. The output is provided in a first operand850.

Described above is one example of a Vector Element Rotate and InsertUnder Mask instruction. This instruction is used to rotate elements in aselected operand by a defined number of bits. Although bits arespecified, in a further embodiment, the elements can be rotated by anumber of positions and the positions may be other than bits. Further,the instruction may be used with different element sizes.

As one example, such an instruction is used for selecting certain bitranges out of numbers for table lookups.

During execution of certain vector instructions or other SIMDoperations, an exception may occur. When an exception occurs on a SIMDoperation, usually it is unknown which element of the vector registercaused the exception. A software interrupt handler has to extract eachelement and re-do the calculation in scalar mode to determine whichelement or elements caused the exception. However, in accordance withone aspect, when the machine (e.g., processor) processes a programinterrupt due to a vector operation, an element index is reportedindicating, e.g., the lowest indexed element in the vector which causedthe exception. The software interrupt handler can then immediately skipto the element in question and perform any required or desired actions.

For instance, in one embodiment, when a vector data exception causes aprogram interruption, a vector exception code (VXC) is stored at, forinstance, real memory location (e.g., location 147 (X ^(|)93^(|)), andzeros are stored at, e.g., real memory locations 144-146 (X ^(|)90^(|)-X^(|)92^(|)). In a further embodiment, the VXC is also placed in a dataexception code (DXC) field of a floating point control register, if aspecified bit (e.g., bit 45) of a designated control register (e.g.,CR0) is 1. When bit 45 of control register 0 is 0 and bit 46 of controlregister 0 is 1, the DXC of the FPC register and the contents of storageat location 147 (X ^(|)93^(|)) are unpredictable.

In one embodiment, the VXC distinguishes between various types of vectorfloating point exceptions and indicates which element caused theexception. In one example, as depicted in FIG. 9A, a vector exceptioncode 900 includes a vector index (VIX) 902, and a vector interrupt code(VIC) 904. In one example, the vector index includes bits 0-3 of thevector exception code, and its value is the index of the leftmostelement of a selected vector register that recognized the exception.Further, the vector interrupt code is included in bits 4-7 of the vectorexception code, and has the following values, as examples:

0001 IEEE Invalid operation 0010 IEEE Division by zero 0011 IEEEOverflow 0100 IEEE Underflow 0101 IEEE Inexact

In a further embodiment, the VXC includes only the vector index or otherposition indicator of an element causing an exception.

In one embodiment, the VXC can be set by a number of instructionsincluding, for instance, the following instructions: Vector FloatingPoint (FP) Add, Vector FP Compare Scalar, Vector FP Compare Equal,Vector FP Compare High or Equal, Vector FP Convert From Fixed 64-Bit,Vector FP Convert From Logical 64-Bit, Vector FP Convert to Fixed64-Bit, Vector FP Convert to Logical 64-BIt, Vector FP Divide, VectorLoad FP Integer, Vector FP Load Lengthened, Vector FP Load Rounded,Vector FP Multiply, Vector FP Multiply and Add, Vector FP Multiple andSubtract, Vector FP Square Root, and Vector FP Subtract, as examples, aswell as other types of vector floating point instructions and/or otherinstructions.

Further details regarding setting the vector exception code is describedwith reference to FIG. 9B. In one embodiment, a processor of thecomputing environment performs this logic.

Referring to FIG. 9B, initially, an instruction that operates on avector register is executed, such as one of the instructions listedabove or another instruction, STEP 920. During execution of theinstruction, an exception condition is encountered, STEP 922. In oneexample, this exception condition causes an interrupt. A determinationis made as to which element of the vector register caused the exception,STEP 924. For instance, one or more hardware units of the processorperforming computation on the one or more elements of the vectorregister determine the exception and provide a signal. For instance, ifa plurality of hardware units is performing computation on a pluralityof elements of a vector register in parallel, and an exception isencountered during processing of one or more of the elements, thehardware unit(s) that is (are) performing the processing thatencountered the exception signals an exception condition, as well as anindication of the element it was processing. In a further embodiment, ifthe elements of the vector are executed sequentially, and an exceptionis encountered during processing of an element the hardware willindicate what element in the sequence it was working on when theexception occurred.

Based on the exception being signaled, the vector exception code is set,STEP 926. This includes, for instance, indicating a position of anelement in the vector register that caused the exception, as well as theinterrupt code.

Described in detail above is a vector exception code that providesefficient vector exception handling. In one example, when a machineprocesses a program interrupt due to a vector operation, an elementindex is reported indicating a lowest indexed element in the vectorregister which caused the exception. As a particular example, if avector add is being performed and there are two elements per vectorregister, providing A0+B0 and A1+B1, and an inexact result is receivedfor A0+B0, but not A1+B1, then VIX is set to 0 and VIC is set equal to0101. In a further example, if it happens that A0+B0 does not receive anexception, but A1+B1 receives an exception, then VIX is set equal to 1(VIC=0101). If both take an exception, then VIX is set to 0 because thatis the leftmost indexed position and VIC=0101.

Described in detail above are various vector instructions, as well as avector exception code that indicates the position of an exception withina vector register. In the flow diagrams provided, some processing mayappear sequential; however, in one or more embodiments, elements areprocessed in parallel, and therefore, there may be no need to check, forinstance, if there are more elements to be processed. Many othervariations are also possible.

Additionally, in further embodiments, contents of one or more fields ofan instruction may be provided in a general purpose register, in memory,in an element of a vector register (differing per element) or from anaddress computation, as examples. They may be included as an explicitoperand of the instruction or as an implied operand or input. Further,one or more instructions may use less operands or inputs, and instead,one or more operands may be used for multiple operations or steps.

Moreover, instead of including an element size control in a field of theinstruction, the element size control can be provided in other ways, asdescribed herein. Additionally the element size can be designated by theopcode. For instance, a particular opcode of the instruction designatesthe operation as well as the size of the elements, etc.

Herein, memory, main memory, storage and main storage are usedinterchangeably, unless otherwise noted explicitly or by context.

As will be appreciated by one skilled in the art, aspects may beembodied as a system, method or computer program product. Accordingly,aspects may take the form of an entirely hardware embodiment, anentirely software embodiment (including firmware, resident software,micro-code, etc.) or an embodiment combining software and hardwareaspects that may all generally be referred to herein as a “circuit,”“module” or “system”. Furthermore, aspects may take the form of acomputer program product embodied in one or more computer readablemedium(s) having computer readable program code embodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readablestorage medium. A computer readable storage medium may be, for example,but not limited to, an electronic, magnetic, optical, electromagnetic,infrared or semiconductor system, apparatus, or device, or any suitablecombination of the foregoing. More specific examples (a non-exhaustivelist) of the computer readable storage medium include the following: anelectrical connection having one or more wires, a portable computerdiskette, a hard disk, a random access memory (RAM), a read-only memory(ROM), an erasable programmable read-only memory (EPROM or Flashmemory), an optical fiber, a portable compact disc read-only memory(CD-ROM), an optical storage device, a magnetic storage device, or anysuitable combination of the foregoing. In the context of this document,a computer readable storage medium may be any tangible medium that cancontain or store a program for use by or in connection with aninstruction execution system, apparatus, or device.

Referring now to FIG. 10, in one example, a computer program product1000 includes, for instance, one or more non-transitory computerreadable storage media 1002 to store computer readable program codemeans or logic 1004 thereon to provide and facilitate one or moreaspects of the present invention.

Program code embodied on a computer readable medium may be transmittedusing an appropriate medium, including but not limited to, wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects may bewritten in any combination of one or more programming languages,including an object oriented programming language, such as JAVA,Smalltalk, C++ or the like, and conventional procedural programminglanguages, such as the “C” programming language, assembler or similarprogramming languages. The program code may execute entirely on theuser's computer, partly on the user's computer, as a stand-alonesoftware package, partly on the user's computer and partly on a remotecomputer or entirely on the remote computer or server. In the latterscenario, the remote computer may be connected to the user's computerthrough any type of network, including a local area network (LAN) or awide area network (WAN), or the connection may be made to an externalcomputer (for example, through the Internet using an Internet ServiceProvider).

Aspects are described herein with reference to flowchart illustrationsand/or block diagrams of methods, apparatus (systems) and computerprogram products according to one or more embodiments. It will beunderstood that each block of the flowchart illustrations and/or blockdiagrams, and combinations of blocks in the flowchart illustrationsand/or block diagrams, can be implemented by computer programinstructions. These computer program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

These computer program instructions may also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

The flowchart and block diagrams in the figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments. In this regard, each block in the flowchart or blockdiagrams may represent a module, segment, or portion of code, whichcomprises one or more executable instructions for implementing thespecified logical function(s). It should also be noted that, in somealternative implementations, the functions noted in the block may occurout of the order noted in the figures. For example, two blocks shown insuccession may, in fact, be executed substantially concurrently, or theblocks may sometimes be executed in the reverse order, depending uponthe functionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts, or combinations of special purpose hardware andcomputer instructions.

In addition to the above, one or more aspects may be provided, offered,deployed, managed, serviced, etc. by a service provider who offersmanagement of customer environments. For instance, the service providercan create, maintain, support, etc. computer code and/or a computerinfrastructure that performs one or more aspects for one or morecustomers. In return, the service provider may receive payment from thecustomer under a subscription and/or fee agreement, as examples.Additionally or alternatively, the service provider may receive paymentfrom the sale of advertising content to one or more third parties.

In one aspect, an application may be deployed for performing one or moreaspects. As one example, the deploying of an application comprisesproviding computer infrastructure operable to perform one or moreaspects.

As a further aspect, a computing infrastructure may be deployedcomprising integrating computer readable code into a computing system,in which the code in combination with the computing system is capable ofperforming one or more aspects.

As yet a further aspect, a process for integrating computinginfrastructure comprising integrating computer readable code into acomputer system may be provided. The computer system comprises acomputer readable medium, in which the computer medium comprises one ormore aspects. The code in combination with the computer system iscapable of performing one or more aspects.

Although various embodiments are described above, these are onlyexamples. For example, computing environments of other architectures canincorporate and use one or more aspects. Further, vectors of other sizesmay be used, and changes to the instructions may be made withoutdeparting from the one or more aspects. Moreover, registers other thanvector registers may be used. Additionally, in other embodiments, avector operand may be a memory location, instead of a vector register.Other variations are also possible.

Further, other types of computing environments can benefit from one ormore aspects. As an example, a data processing system suitable forstoring and/or executing program code is usable that includes at leasttwo processors coupled directly or indirectly to memory elements througha system bus. The memory elements include, for instance, local memoryemployed during actual execution of the program code, bulk storage, andcache memory which provide temporary storage of at least some programcode in order to reduce the number of times code must be retrieved frombulk storage during execution.

Input/Output or I/O devices (including, but not limited to, keyboards,displays, pointing devices, DASD, tape, CDs, DVDs, thumb drives andother memory media, etc.) can be coupled to the system either directlyor through intervening I/O controllers. Network adapters may also becoupled to the system to enable the data processing system to becomecoupled to other data processing systems or remote printers or storagedevices through intervening private or public networks. Modems, cablemodems, and Ethernet cards are just a few of the available types ofnetwork adapters.

Referring to FIG. 11, representative components of a Host Computersystem 5000 to implement one or more aspects are portrayed. Therepresentative host computer 5000 comprises one or more CPUs 5001 incommunication with computer memory (i.e., central storage) 5002, as wellas I/O interfaces to storage media devices 5011 and networks 5010 forcommunicating with other computers or SANs and the like. The CPU 5001 iscompliant with an architecture having an architected instruction set andarchitected functionality. The CPU 5001 may have dynamic addresstranslation (DAT) 5003 for transforming program addresses (virtualaddresses) into real addresses of memory. A DAT typically includes atranslation lookaside buffer (TLB) 5007 for caching translations so thatlater accesses to the block of computer memory 5002 do not require thedelay of address translation. Typically, a cache 5009 is employedbetween computer memory 5002 and the processor 5001. The cache 5009 maybe hierarchical having a large cache available to more than one CPU andsmaller, faster (lower level) caches between the large cache and eachCPU. In some implementations, the lower level caches are split toprovide separate low level caches for instruction fetching and dataaccesses. In one embodiment, an instruction is fetched from memory 5002by an instruction fetch unit 5004 via a cache 5009. The instruction isdecoded in an instruction decode unit 5006 and dispatched (with otherinstructions in some embodiments) to instruction execution unit or units5008. Typically several execution units 5008 are employed, for examplean arithmetic execution unit, a floating point execution unit and abranch instruction execution unit. The instruction is executed by theexecution unit, accessing operands from instruction specified registersor memory as needed. If an operand is to be accessed (loaded or stored)from memory 5002, a load/store unit 5005 typically handles the accessunder control of the instruction being executed. Instructions may beexecuted in hardware circuits or in internal microcode (firmware) or bya combination of both.

As noted, a computer system includes information in local (or main)storage, as well as addressing, protection, and reference and changerecording. Some aspects of addressing include the format of addresses,the concept of address spaces, the various types of addresses, and themanner in which one type of address is translated to another type ofaddress. Some of main storage includes permanently assigned storagelocations. Main storage provides the system with directly addressablefast-access storage of data. Both data and programs are to be loadedinto main storage (from input devices) before they can be processed.

Main storage may include one or more smaller, faster-access bufferstorages, sometimes called caches. A cache is typically physicallyassociated with a CPU or an I/O processor. The effects, except onperformance, of the physical construction and use of distinct storagemedia are generally not observable by the program.

Separate caches may be maintained for instructions and for dataoperands. Information within a cache is maintained in contiguous byteson an integral boundary called a cache block or cache line (or line, forshort). A model may provide an EXTRACT CACHE ATTRIBUTE instruction whichreturns the size of a cache line in bytes. A model may also providePREFETCH DATA and PREFETCH DATA RELATIVE LONG instructions which effectsthe prefetching of storage into the data or instruction cache or thereleasing of data from the cache.

Storage is viewed as a long horizontal string of bits. For mostoperations, accesses to storage proceed in a left-to-right sequence. Thestring of bits is subdivided into units of eight bits. An eight-bit unitis called a byte, which is the basic building block of all informationformats. Each byte location in storage is identified by a uniquenonnegative integer, which is the address of that byte location or,simply, the byte address. Adjacent byte locations have consecutiveaddresses, starting with 0 on the left proceeding in a left-to-rightsequence. Addresses are unsigned binary integers and are 24, 31, or 64bits.

Information is transmitted between storage and a CPU or a channelsubsystem one byte, or a group of bytes, at a time. Unless otherwisespecified, in, for instance, the z/Architecture, a group of bytes instorage is addressed by the leftmost byte of the group. The number ofbytes in the group is either implied or explicitly specified by theoperation to be performed. When used in a CPU operation, a group ofbytes is called a field. Within each group of bytes, in, for instance,the z/Architecture, bits are numbered in a left-to-right sequence. Inthe z/Architecture, the leftmost bits are sometimes referred to as the“high-order” bits and the rightmost bits as the “low-order” bits. Bitnumbers are not storage addresses, however. Only bytes can be addressed.To operate on individual bits of a byte in storage, the entire byte isaccessed. The bits in a byte are numbered 0 through 7, from left toright (in, e.g., the z/Architecture). The bits in an address may benumbered 8-31 or 40-63 for 24-bit addresses, or 1-31 or 33-63 for 31-bitaddresses; they are numbered 0-63 for 64-bit addresses. Within any otherfixed-length format of multiple bytes, the bits making up the format areconsecutively numbered starting from 0. For purposes of error detection,and in preferably for correction, one or more check bits may betransmitted with each byte or with a group of bytes. Such check bits aregenerated automatically by the machine and cannot be directly controlledby the program. Storage capacities are expressed in number of bytes.When the length of a storage-operand field is implied by the operationcode of an instruction, the field is said to have a fixed length, whichcan be one, two, four, eight, or sixteen bytes. Larger fields may beimplied for some instructions. When the length of a storage-operandfield is not implied but is stated explicitly, the field is said to havea variable length. Variable-length operands can vary in length byincrements of one byte (or with some instructions, in multiples of twobytes or other multiples). When information is placed in storage, thecontents of only those byte locations are replaced that are included inthe designated field, even though the width of the physical path tostorage may be greater than the length of the field being stored.

Certain units of information are to be on an integral boundary instorage. A boundary is called integral for a unit of information whenits storage address is a multiple of the length of the unit in bytes.Special names are given to fields of 2, 4, 8, and 16 bytes on anintegral boundary. A halfword is a group of two consecutive bytes on atwo-byte boundary and is the basic building block of instructions. Aword is a group of four consecutive bytes on a four-byte boundary. Adoubleword is a group of eight consecutive bytes on an eight-byteboundary. A quadword is a group of 16 consecutive bytes on a 16-byteboundary. When storage addresses designate halfwords, words,doublewords, and quadwords, the binary representation of the addresscontains one, two, three, or four rightmost zero bits, respectively.Instructions are to be on two-byte integral boundaries. The storageoperands of most instructions do not have boundary-alignmentrequirements.

On devices that implement separate caches for instructions and dataoperands, a significant delay may be experienced if the program storesinto a cache line from which instructions are subsequently fetched,regardless of whether the store alters the instructions that aresubsequently fetched.

In one embodiment, the invention may be practiced by software (sometimesreferred to licensed internal code, firmware, micro-code, milli-code,pico-code and the like, any of which would be consistent with one ormore aspects). Referring to FIG. 11, software program code whichembodies one or more aspects may be accessed by processor 5001 of thehost system 5000 from long-term storage media devices 5011, such as aCD-ROM drive, tape drive or hard drive. The software program code may beembodied on any of a variety of known media for use with a dataprocessing system, such as a diskette, hard drive, or CD-ROM. The codemay be distributed on such media, or may be distributed to users fromcomputer memory 5002 or storage of one computer system over a network5010 to other computer systems for use by users of such other systems.

The software program code includes an operating system which controlsthe function and interaction of the various computer components and oneor more application programs. Program code is normally paged fromstorage media device 5011 to the relatively higher-speed computerstorage 5002 where it is available for processing by processor 5001. Thetechniques and methods for embodying software program code in memory, onphysical media, and/or distributing software code via networks are wellknown and will not be further discussed herein. Program code, whencreated and stored on a tangible medium (including but not limited toelectronic memory modules (RAM), flash memory, Compact Discs (CDs),DVDs, Magnetic Tape and the like is often referred to as a “computerprogram product”. The computer program product medium is typicallyreadable by a processing circuit preferably in a computer system forexecution by the processing circuit.

FIG. 12 illustrates a representative workstation or server hardwaresystem in which one or more aspects may be practiced. The system 5020 ofFIG. 12 comprises a representative base computer system 5021, such as apersonal computer, a workstation or a server, including optionalperipheral devices. The base computer system 5021 includes one or moreprocessors 5026 and a bus employed to connect and enable communicationbetween the processor(s) 5026 and the other components of the system5021 in accordance with known techniques. The bus connects the processor5026 to memory 5025 and long-term storage 5027 which can include a harddrive (including any of magnetic media, CD, DVD and Flash Memory forexample) or a tape drive for example. The system 5021 might also includea user interface adapter, which connects the microprocessor 5026 via thebus to one or more interface devices, such as a keyboard 5024, a mouse5023, a printer/scanner 5030 and/or other interface devices, which canbe any user interface device, such as a touch sensitive screen,digitized entry pad, etc. The bus also connects a display device 5022,such as an LCD screen or monitor, to the microprocessor 5026 via adisplay adapter.

The system 5021 may communicate with other computers or networks ofcomputers by way of a network adapter capable of communicating 5028 witha network 5029. Example network adapters are communications channels,token ring, Ethernet or modems. Alternatively, the system 5021 maycommunicate using a wireless interface, such as a CDPD (cellular digitalpacket data) card. The system 5021 may be associated with such othercomputers in a Local Area Network (LAN) or a Wide Area Network (WAN), orthe system 5021 can be a client in a client/server arrangement withanother computer, etc. All of these configurations, as well as theappropriate communications hardware and software, are known in the art.

FIG. 13 illustrates a data processing network 5040 in which one or moreaspects may be practiced. The data processing network 5040 may include aplurality of individual networks, such as a wireless network and a wirednetwork, each of which may include a plurality of individualworkstations 5041, 5042, 5043, 5044. Additionally, as those skilled inthe art will appreciate, one or more LANs may be included, where a LANmay comprise a plurality of intelligent workstations coupled to a hostprocessor.

Still referring to FIG. 13, the networks may also include mainframecomputers or servers, such as a gateway computer (client server 5046) orapplication server (remote server 5048 which may access a datarepository and may also be accessed directly from a workstation 5045). Agateway computer 5046 serves as a point of entry into each individualnetwork. A gateway is needed when connecting one networking protocol toanother. The gateway 5046 may be preferably coupled to another network(the Internet 5047 for example) by means of a communications link. Thegateway 5046 may also be directly coupled to one or more workstations5041, 5042, 5043, 5044 using a communications link. The gateway computermay be implemented utilizing an IBM eServer™ System z server availablefrom International Business Machines Corporation.

Referring concurrently to FIG. 12 and FIG. 13, software programming codewhich may embody one or more aspects of the present invention may beaccessed by the processor 5026 of the system 5020 from long-term storagemedia 5027, such as a CD-ROM drive or hard drive. The softwareprogramming code may be embodied on any of a variety of known media foruse with a data processing system, such as a diskette, hard drive, orCD-ROM. The code may be distributed on such media, or may be distributedto users 5050, 5051 from the memory or storage of one computer systemover a network to other computer systems for use by users of such othersystems.

Alternatively, the programming code may be embodied in the memory 5025,and accessed by the processor 5026 using the processor bus. Suchprogramming code includes an operating system which controls thefunction and interaction of the various computer components and one ormore application programs 5032. Program code is normally paged fromstorage media 5027 to high-speed memory 5025 where it is available forprocessing by the processor 5026. The techniques and methods forembodying software programming code in memory, on physical media, and/ordistributing software code via networks are well known and will not befurther discussed herein. Program code, when created and stored on atangible medium (including but not limited to electronic memory modules(RAM), flash memory, Compact Discs (CDs), DVDs, Magnetic Tape and thelike is often referred to as a “computer program product”. The computerprogram product medium is typically readable by a processing circuitpreferably in a computer system for execution by the processing circuit.

The cache that is most readily available to the processor (normallyfaster and smaller than other caches of the processor) is the lowest (L1or level one) cache and main store (main memory) is the highest levelcache (L3 if there are 3 levels). The lowest level cache is oftendivided into an instruction cache (I-Cache) holding machine instructionsto be executed and a data cache (D-Cache) holding data operands.

Referring to FIG. 14, an exemplary processor embodiment is depicted forprocessor 5026. Typically one or more levels of cache 5053 are employedto buffer memory blocks in order to improve processor performance. Thecache 5053 is a high speed buffer holding cache lines of memory datathat are likely to be used. Typical cache lines are 64, 128 or 256 bytesof memory data. Separate caches are often employed for cachinginstructions than for caching data. Cache coherence (synchronization ofcopies of lines in memory and the caches) is often provided by various“snoop” algorithms well known in the art. Main memory storage 5025 of aprocessor system is often referred to as a cache. In a processor systemhaving 4 levels of cache 5053, main storage 5025 is sometimes referredto as the level 5 (L5) cache since it is typically faster and only holdsa portion of the non-volatile storage (DASD, tape etc) that is availableto a computer system. Main storage 5025 “caches” pages of data paged inand out of the main storage 5025 by the operating system.

A program counter (instruction counter) 5061 keeps track of the addressof the current instruction to be executed. A program counter in az/Architecture processor is 64 bits and can be truncated to 31 or 24bits to support prior addressing limits. A program counter is typicallyembodied in a PSW (program status word) of a computer such that itpersists during context switching. Thus, a program in progress, having aprogram counter value, may be interrupted by, for example, the operatingsystem (context switch from the program environment to the operatingsystem environment). The PSW of the program maintains the programcounter value while the program is not active, and the program counter(in the PSW) of the operating system is used while the operating systemis executing. Typically, the program counter is incremented by an amountequal to the number of bytes of the current instruction. RISC (ReducedInstruction Set Computing) instructions are typically fixed length whileCISC (Complex Instruction Set Computing) instructions are typicallyvariable length. Instructions of the IBM z/Architecture are CISCinstructions having a length of 2, 4 or 6 bytes. The Program counter5061 is modified by either a context switch operation or a branch takenoperation of a branch instruction for example. In a context switchoperation, the current program counter value is saved in the programstatus word along with other state information about the program beingexecuted (such as condition codes), and a new program counter value isloaded pointing to an instruction of a new program module to beexecuted. A branch taken operation is performed in order to permit theprogram to make decisions or loop within the program by loading theresult of the branch instruction into the program counter 5061.

Typically an instruction fetch unit 5055 is employed to fetchinstructions on behalf of the processor 5026. The fetch unit eitherfetches “next sequential instructions”, target instructions of branchtaken instructions, or first instructions of a program following acontext switch. Modern Instruction fetch units often employ prefetchtechniques to speculatively prefetch instructions based on thelikelihood that the prefetched instructions might be used. For example,a fetch unit may fetch 16 bytes of instruction that includes the nextsequential instruction and additional bytes of further sequentialinstructions.

The fetched instructions are then executed by the processor 5026. In anembodiment, the fetched instruction(s) are passed to a dispatch unit5056 of the fetch unit. The dispatch unit decodes the instruction(s) andforwards information about the decoded instruction(s) to appropriateunits 5057, 5058, 5060. An execution unit 5057 will typically receiveinformation about decoded arithmetic instructions from the instructionfetch unit 5055 and will perform arithmetic operations on operandsaccording to the opcode of the instruction. Operands are provided to theexecution unit 5057 preferably either from memory 5025, architectedregisters 5059 or from an immediate field of the instruction beingexecuted. Results of the execution, when stored, are stored either inmemory 5025, registers 5059 or in other machine hardware (such ascontrol registers, PSW registers and the like).

A processor 5026 typically has one or more units 5057, 5058, 5060 forexecuting the function of the instruction. Referring to FIG. 15A, anexecution unit 5057 may communicate with architected general registers5059, a decode/dispatch unit 5056, a load store unit 5060, and other5065 processor units by way of interfacing logic 5071. An execution unit5057 may employ several register circuits 5067, 5068, 5069 to holdinformation that the arithmetic logic unit (ALU) 5066 will operate on.The ALU performs arithmetic operations such as add, subtract, multiplyand divide as well as logical function such as and, or and exclusive-or(XOR), rotate and shift. Preferably the ALU supports specializedoperations that are design dependent. Other circuits may provide otherarchitected facilities 5072 including condition codes and recoverysupport logic for example. Typically the result of an ALU operation isheld in an output register circuit 5070 which can forward the result toa variety of other processing functions. There are many arrangements ofprocessor units, the present description is only intended to provide arepresentative understanding of one embodiment.

An ADD instruction for example would be executed in an execution unit5057 having arithmetic and logical functionality while a floating pointinstruction for example would be executed in a floating point executionhaving specialized floating point capability. Preferably, an executionunit operates on operands identified by an instruction by performing anopcode defined function on the operands. For example, an ADD instructionmay be executed by an execution unit 5057 on operands found in tworegisters 5059 identified by register fields of the instruction.

The execution unit 5057 performs the arithmetic addition on two operandsand stores the result in a third operand where the third operand may bea third register or one of the two source registers. The execution unitpreferably utilizes an Arithmetic Logic Unit (ALU) 5066 that is capableof performing a variety of logical functions such as Shift, Rotate, And,Or and XOR as well as a variety of algebraic functions including any ofadd, subtract, multiply, divide. Some ALUs 5066 are designed for scalaroperations and some for floating point. Data may be Big Endian (wherethe least significant byte is at the highest byte address) or LittleEndian (where the least significant byte is at the lowest byte address)depending on architecture. The IBM z/Architecture is Big Endian. Signedfields may be sign and magnitude, 1's complement or 2's complementdepending on architecture. A 2's complement number is advantageous inthat the ALU does not need to design a subtract capability since eithera negative value or a positive value in 2's complement requires only anaddition within the ALU. Numbers are commonly described in shorthand,where a 12 bit field defines an address of a 4,096 byte block and iscommonly described as a 4 Kbyte (Kilo-byte) block, for example.

Referring to FIG. 15B, branch instruction information for executing abranch instruction is typically sent to a branch unit 5058 which oftenemploys a branch prediction algorithm such as a branch history table5082 to predict the outcome of the branch before other conditionaloperations are complete. The target of the current branch instructionwill be fetched and speculatively executed before the conditionaloperations are complete. When the conditional operations are completedthe speculatively executed branch instructions are either completed ordiscarded based on the conditions of the conditional operation and thespeculated outcome. A typical branch instruction may test conditioncodes and branch to a target address if the condition codes meet thebranch requirement of the branch instruction, a target address may becalculated based on several numbers including ones found in registerfields or an immediate field of the instruction for example. The branchunit 5058 may employ an ALU 5074 having a plurality of input registercircuits 5075, 5076, 5077 and an output register circuit 5080. Thebranch unit 5058 may communicate with general registers 5059, decodedispatch unit 5056 or other circuits 5073, for example.

The execution of a group of instructions can be interrupted for avariety of reasons including a context switch initiated by an operatingsystem, a program exception or error causing a context switch, an I/Ointerruption signal causing a context switch or multi-threading activityof a plurality of programs (in a multi-threaded environment), forexample. Preferably a context switch action saves state informationabout a currently executing program and then loads state informationabout another program being invoked. State information may be saved inhardware registers or in memory for example. State informationpreferably comprises a program counter value pointing to a nextinstruction to be executed, condition codes, memory translationinformation and architected register content. A context switch activitycan be exercised by hardware circuits, application programs, operatingsystem programs or firmware code (microcode, pico-code or licensedinternal code (LIC)) alone or in combination.

A processor accesses operands according to instruction defined methods.The instruction may provide an immediate operand using the value of aportion of the instruction, may provide one or more register fieldsexplicitly pointing to either general purpose registers or specialpurpose registers (floating point registers for example). Theinstruction may utilize implied registers identified by an opcode fieldas operands. The instruction may utilize memory locations for operands.A memory location of an operand may be provided by a register, animmediate field, or a combination of registers and immediate field asexemplified by the z/Architecture long displacement facility wherein theinstruction defines a base register, an index register and an immediatefield (displacement field) that are added together to provide theaddress of the operand in memory for example. Location herein typicallyimplies a location in main memory (main storage) unless otherwiseindicated.

Referring to FIG. 15C, a processor accesses storage using a load/storeunit 5060. The load/store unit 5060 may perform a load operation byobtaining the address of the target operand in memory 5053 and loadingthe operand in a register 5059 or another memory 5053 location, or mayperform a store operation by obtaining the address of the target operandin memory 5053 and storing data obtained from a register 5059 or anothermemory 5053 location in the target operand location in memory 5053. Theload/store unit 5060 may be speculative and may access memory in asequence that is out-of-order relative to instruction sequence, howeverthe load/store unit 5060 is to maintain the appearance to programs thatinstructions were executed in order. A load/store unit 5060 maycommunicate with general registers 5059, decode/dispatch unit 5056,cache/memory interface 5053 or other elements 5083 and comprises variousregister circuits, ALUs 5085 and control logic 5090 to calculate storageaddresses and to provide pipeline sequencing to keep operationsin-order. Some operations may be out of order but the load/store unitprovides functionality to make the out of order operations to appear tothe program as having been performed in order, as is well known in theart.

Preferably addresses that an application program “sees” are oftenreferred to as virtual addresses. Virtual addresses are sometimesreferred to as “logical addresses” and “effective addresses”. Thesevirtual addresses are virtual in that they are redirected to physicalmemory location by one of a variety of dynamic address translation (DAT)technologies including, but not limited to, simply prefixing a virtualaddress with an offset value, translating the virtual address via one ormore translation tables, the translation tables preferably comprising atleast a segment table and a page table alone or in combination,preferably, the segment table having an entry pointing to the pagetable. In the z/Architecture, a hierarchy of translation is providedincluding a region first table, a region second table, a region thirdtable, a segment table and an optional page table. The performance ofthe address translation is often improved by utilizing a translationlookaside buffer (TLB) which comprises entries mapping a virtual addressto an associated physical memory location. The entries are created whenthe DAT translates a virtual address using the translation tables.Subsequent use of the virtual address can then utilize the entry of thefast TLB rather than the slow sequential translation table accesses. TLBcontent may be managed by a variety of replacement algorithms includingLRU (Least Recently used).

In the case where the processor is a processor of a multi-processorsystem, each processor has responsibility to keep shared resources, suchas I/O, caches, TLBs and memory, interlocked for coherency. Typically,“snoop” technologies will be utilized in maintaining cache coherency. Ina snoop environment, each cache line may be marked as being in any oneof a shared state, an exclusive state, a changed state, an invalid stateand the like in order to facilitate sharing.

I/O units 5054 (FIG. 14) provide the processor with means for attachingto peripheral devices including tape, disc, printers, displays, andnetworks for example. I/O units are often presented to the computerprogram by software drivers. In mainframes, such as the System z fromIBM®, channel adapters and open system adapters are I/O units of themainframe that provide the communications between the operating systemand peripheral devices.

Further, other types of computing environments can benefit from one ormore aspects. As an example, an environment may include an emulator(e.g., software or other emulation mechanisms), in which a particulararchitecture (including, for instance, instruction execution,architected functions, such as address translation, and architectedregisters) or a subset thereof is emulated (e.g., on a native computersystem having a processor and memory). In such an environment, one ormore emulation functions of the emulator can implement one or moreaspects of the present invention, even though a computer executing theemulator may have a different architecture than the capabilities beingemulated. As one example, in emulation mode, the specific instruction oroperation being emulated is decoded, and an appropriate emulationfunction is built to implement the individual instruction or operation.

In an emulation environment, a host computer includes, for instance, amemory to store instructions and data; an instruction fetch unit tofetch instructions from memory and to optionally, provide localbuffering for the fetched instruction; an instruction decode unit toreceive the fetched instructions and to determine the type ofinstructions that have been fetched; and an instruction execution unitto execute the instructions. Execution may include loading data into aregister from memory; storing data back to memory from a register; orperforming some type of arithmetic or logical operation, as determinedby the decode unit. In one example, each unit is implemented insoftware. For instance, the operations being performed by the units areimplemented as one or more subroutines within emulator software.

More particularly, in a mainframe, architected machine instructions areused by programmers, usually today “C” programmers, often by way of acompiler application. These instructions stored in the storage mediummay be executed natively in a z/Architecture IBM® Server, oralternatively in machines executing other architectures. They can beemulated in the existing and in future IBM® mainframe servers and onother machines of IBM® (e.g., Power Systems servers and System x®Servers). They can be executed in machines running Linux on a widevariety of machines using hardware manufactured by IBM®, Intel®, AMD™,and others. Besides execution on that hardware under a z/Architecture,Linux can be used as well as machines which use emulation by Hercules,UMX, or FSI (Fundamental Software, Inc), where generally execution is inan emulation mode. In emulation mode, emulation software is executed bya native processor to emulate the architecture of an emulated processor.

The native processor typically executes emulation software comprisingeither firmware or a native operating system to perform emulation of theemulated processor. The emulation software is responsible for fetchingand executing instructions of the emulated processor architecture. Theemulation software maintains an emulated program counter to keep trackof instruction boundaries. The emulation software may fetch one or moreemulated machine instructions at a time and convert the one or moreemulated machine instructions to a corresponding group of native machineinstructions for execution by the native processor. These convertedinstructions may be cached such that a faster conversion can beaccomplished. Notwithstanding, the emulation software is to maintain thearchitecture rules of the emulated processor architecture so as toassure operating systems and applications written for the emulatedprocessor operate correctly. Furthermore, the emulation software is toprovide resources identified by the emulated processor architectureincluding, but not limited to, control registers, general purposeregisters, floating point registers, dynamic address translationfunction including segment tables and page tables for example, interruptmechanisms, context switch mechanisms, Time of Day (TOD) clocks andarchitected interfaces to I/O subsystems such that an operating systemor an application program designed to run on the emulated processor, canbe run on the native processor having the emulation software.

A specific instruction being emulated is decoded, and a subroutine iscalled to perform the function of the individual instruction. Anemulation software function emulating a function of an emulatedprocessor is implemented, for example, in a “C” subroutine or driver, orsome other method of providing a driver for the specific hardware aswill be within the skill of those in the art after understanding thedescription of one or more embodiments. Various software and hardwareemulation patents including, but not limited to U.S. Pat. No. 5,551,013,entitled “Multiprocessor for Hardware Emulation”, by Beausoleil et al.;and U.S. Pat. No. 6,009,261, entitled “Preprocessing of Stored TargetRoutines for Emulating Incompatible Instructions on a Target Processor”,by Scalzi et al; and U.S. Pat. No. 5,574,873, entitled “Decoding GuestInstruction to Directly Access Emulation Routines that Emulate the GuestInstructions”, by Davidian et al; and U.S. Pat. No. 6,308,255, entitled“Symmetrical Multiprocessing Bus and Chipset Used for CoprocessorSupport Allowing Non-Native Code to Run in a System”, by Gorishek et al;and U.S. Pat. No. 6,463,582, entitled “Dynamic Optimizing Object CodeTranslator for Architecture Emulation and Dynamic Optimizing Object CodeTranslation Method”, by Lethin et al; and U.S. Pat. No. 5,790,825,entitled “Method for Emulating Guest Instructions on a Host ComputerThrough Dynamic Recompilation of Host Instructions”, by Eric Traut, eachof which is hereby incorporated herein by reference in its entirety; andmany others, illustrate a variety of known ways to achieve emulation ofan instruction format architected for a different machine for a targetmachine available to those skilled in the art.

In FIG. 16, an example of an emulated host computer system 5092 isprovided that emulates a host computer system 5000′ of a hostarchitecture. In the emulated host computer system 5092, the hostprocessor (CPU) 5091 is an emulated host processor (or virtual hostprocessor) and comprises an emulation processor 5093 having a differentnative instruction set architecture than that of the processor 5091 ofthe host computer 5000′. The emulated host computer system 5092 hasmemory 5094 accessible to the emulation processor 5093. In the exampleembodiment, the memory 5094 is partitioned into a host computer memory5096 portion and an emulation routines 5097 portion. The host computermemory 5096 is available to programs of the emulated host computer 5092according to host computer architecture. The emulation processor 5093executes native instructions of an architected instruction set of anarchitecture other than that of the emulated processor 5091, the nativeinstructions obtained from emulation routines memory 5097, and mayaccess a host instruction for execution from a program in host computermemory 5096 by employing one or more instruction(s) obtained in asequence & access/decode routine which may decode the hostinstruction(s) accessed to determine a native instruction executionroutine for emulating the function of the host instruction accessed.Other facilities that are defined for the host computer system 5000′architecture may be emulated by architected facilities routines,including such facilities as general purpose registers, controlregisters, dynamic address translation and I/O subsystem support andprocessor cache, for example. The emulation routines may also takeadvantage of functions available in the emulation processor 5093 (suchas general registers and dynamic translation of virtual addresses) toimprove performance of the emulation routines. Special hardware andoff-load engines may also be provided to assist the processor 5093 inemulating the function of the host computer 5000′.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising”, when used in this specification, specify thepresence of stated features, integers, steps, operations, elements,and/or components, but do not preclude the presence or addition of oneor more other features, integers, steps, operations, elements,components and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below, if any, areintended to include any structure, material, or act for performing thefunction in combination with other claimed elements as specificallyclaimed. The description of one or more aspects has been presented forpurposes of illustration and description, but is not intended to beexhaustive limited to the invention in the form disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of one or moreaspects. The embodiment was chosen and described in order to bestexplain the principles of the one or more aspects and the practicalapplication, and to enable others of ordinary skill in the art tounderstand the one or more aspects for various embodiments with variousmodifications as are suited to the particular use contemplated.

What is claimed is:
 1. A method of executing a machine instruction in acentral processing unit, the method comprising: obtaining, by aprocessor, a machine instruction for execution, the machine instructionbeing defined for computer execution according to a computerarchitecture, the machine instruction comprising: at least one opcodefield to provide an opcode, the opcode identifying a Vector Galois FieldMultiply Sum and Accumulate operation; a first register field to be usedto designate a first register, the first register comprising a firstoperand; a second register field to be used to designate a secondregister, the second register comprising a second operand; a thirdregister field to be used to designate a third register, the thirdregister comprising a third operand; a fourth register field to be usedto designate a fourth register, the fourth register comprising a fourthoperand; and a mask field to specify a size of elements of one or moreof the first operand, the second operand, the third operand or thefourth operand, wherein the mask field specifies the size of theelements of the second operand and the third operand; and executing themachine instruction, the executing comprising: multiplying one or moreelements of the second operand with one or more elements of the thirdoperand using carryless multiplication to obtain a plurality ofproducts; performing a first mathematical operation on the plurality ofproducts to obtain a first result; performing a second mathematicaloperation on the first result and one or more selected elements of thefourth operand to obtain a second result; and placing the second resultin the first operand.
 2. The method of claim 1, wherein the multiplyingcomprises multiplying each element of the second operand with thecorresponding element of the third operand using carrylessmultiplication resulting in even-odd pairs of double element-sizedproducts.
 3. The method of claim 2, wherein the carryless multiplicationhas an order of two.
 4. The method of claim 2, wherein the firstmathematical operation comprises an exclusive OR operation, and whereinthe even-odd pairs of double element-sized products are exclusive ORedwith each other to obtain the first result.
 5. The method of claim 4,wherein the second mathematical operation comprises an exclusive ORoperation, and wherein the first result is exclusive ORed with acorresponding double-wide element of the fourth operand to obtain thesecond result.
 6. The method of claim 5, wherein the placing comprisesplacing the second result in a double-wide element of the first operand.7. The method of claim 1, wherein the size of the elements of the firstoperand and the fourth operand are double the size of the elements ofthe second operand and the third operand.
 8. The method of claim 1,wherein the machine instruction further comprises an extension field tobe used in designating one or more registers, and wherein the firstregister field is combined with a first portion of the extension fieldto designate the first register, the second register field is combinedwith a second portion of the extension field to designate the secondregister, the third register field is combined with a third portion ofthe extension field to designate the third register and the fourthregister field is combined with a fourth portion of the extension fieldto designate the fourth register.
 9. A method of executing a machineinstruction in a central processing unit, the method comprising:obtaining, by a processor, a machine instruction for execution, themachine instruction being defined for computer execution according to acomputer architecture, the machine instruction comprising: at least oneopcode field to provide an opcode, the opcode identifying a VectorGalois Field Multiply Sum and Accumulate operation; a first registerfield to be used to designate a first register, the first registercomprising a first operand; a second register field to be used todesignate a second register, the second register comprising a secondoperand; a third register field to be used to designate a thirdregister, the third register comprising a third operand; a fourthregister field to be used to designate a fourth register, the fourthregister comprising a fourth operand; and an extension field to be usedin designating one or more registers, wherein the first register fieldis combined with a first portion of the extension field to designate thefirst register, the second register field is combined with a secondportion of the extension field to designate the second register, thethird register field is combined with a third portion of the extensionfield to designate the third register, and the fourth register field iscombined with a fourth portion of the extension field to designate thefourth register; and executing the machine instruction, the executingcomprising: multiplying one or more elements of the second operand withone or more elements of the third operand using carryless multiplicationto obtain a plurality of products; performing a first mathematicaloperation on the plurality of products to obtain a first result;performing a second mathematical operation on the first result and oneor more selected elements of the fourth operand to obtain a secondresult; and placing the second result in the first operand.
 10. Themethod of claim 9, wherein the multiplying comprises multiplying eachelement of the second operand with the corresponding element of thethird operand using carryless multiplication resulting in even-odd pairsof double element-sized products.
 11. The method of claim 10, whereinthe carryless multiplication has an order of two.
 12. The method ofclaim 10, wherein the first mathematical operation comprises anexclusive OR operation, and wherein the even-odd pairs of doubleelement-sized products are exclusive ORed with each other to obtain thefirst result.
 13. The method of claim 12, wherein the secondmathematical operation comprises an exclusive OR operation, and whereinthe first result is exclusive ORed with a corresponding double-wideelement of the fourth operand to obtain the second result.
 14. Themethod of claim 13, wherein the placing comprises placing the secondresult in a double-wide element of the first operand.
 15. The method ofclaim 9, wherein a size of elements of the first operand and the fourthoperand are double the size of elements of the second operand and thethird operand.
 16. The method of claim 9, wherein the machineinstruction further comprises a mask field to specify a size of elementsof one or more of the first operand, the second operand, the thirdoperand or the fourth operand of the machine instruction.
 17. The methodof claim 9, wherein the machine instruction further comprises a maskfield to specify a size of elements of the second operand and the thirdoperand.